
#include "stdafx.h"

#include "ParamBidWin.h"
#include "dencode.h"

void CParamBidWin::readINI(const CINIOperater *oper)
{
	if (oper->hasKey(section, regParm.loginKey() + L"TopLeft") && oper->hasKey(section, regParm.loginKey() + L"BottomRight"))
	{
		CPoint p0 = oper->GetPoint(section, regParm.loginKey() + L"TopLeft", CPoint(0, 0));
		CPoint p1 = oper->GetPoint(section, regParm.loginKey() + L"BottomRight", CPoint(0, 0));
		winRect = CRect(p0, p1); rectAvailable = true;
	}
	else
		rectAvailable = false;
	if (oper->hasKey(section, regParm.loginKey() + L"ScrollOffset"))
	{
		scrlOffset = oper->GetPoint(section, regParm.loginKey() + L"ScrollOffset", CPoint(0, 0));
#ifdef _WEBKIT_NEW
		renderOffset= oper->GetPoint(section, regParm.loginKey() + L"RenderOffset", CPoint(0, 0));
#endif
		offsetAvailable = true;
	}
	else
		offsetAvailable = false;
}

void CParamBidWin::writeINI(CINIOperater *oper) const
{
	if (rectAvailable)
	{
		CPoint p0 = winRect.TopLeft(); oper->WritePoint(section, regParm.loginKey() + L"TopLeft", &p0);
		CPoint p1 = winRect.BottomRight(); oper->WritePoint(section, regParm.loginKey() + L"BottomRight", &p1);
	}
	if (offsetAvailable)
	{
		oper->WritePoint(section, regParm.loginKey() + L"ScrollOffset", &scrlOffset);
#ifdef _WEBKIT_NEW
		oper->WritePoint(section, regParm.loginKey() + L"RenderOffset", &renderOffset);
#endif
	}
}

